/*YuO8szH0cVixePu/Bt+mG2xEldcD/te7MH4FzhVNtb+Aw0Pn8HvMYyRA4OFSt14I*/
import { ajax, base, spaCache, toast} from 'nc-lightapp-front';
let { setDefData, getDefData } = spaCache;
import { pagecode, searchId, headId, bodyId, billType, dataSource } from '../constants';
import {sortFunction} from '../../../../public/components/pubUtils/billPubUtil'


//点击查询，获取查询区数据
export default function () {
	let searchVal = this.props.search.getAllSearchData(searchId);
	if (searchVal && this.props.getUrlParam('dest_tradetype')) {
		let data = {
			queryInfo: this.props.search.getQueryInfo(searchId),
			appcode: this.props.getUrlParam('src_appcode'),
			pageId: pagecode,
			src_billtype: billType,
			dest_tradetype: this.props.getUrlParam('dest_tradetype'),
			busitype: getDefData(billType + this.props.getUrlParam('src_tradetype'), "transfer.dataSource")
		}
		ajax({
			url: '/nccloud/arap/arappub/transferquery.do',
			data: data,
			success: (res) => {
				if (res.data) {
					let newdata = res.data.sort(sortFunction('billdate','billno',headId))
					this.props.transferTable.setTransferTableValue(headId, bodyId, newdata, 'pk_gatherbill', 'pk_gatheritem');
					/*
					* key：存储数据的key
					* dataSource: 缓存数据命名空间
					* data： 存储数据
					*/
					setDefData('searchData', dataSource, res.data);
				} else {
					this.props.transferTable.setTransferTableValue(headId, bodyId, [], 'pk_gatherbill', 'pk_gatheritem');
					toast({ content: this.state.json['gatheringbill-000055'], color: 'warning'});/* 国际化处理： 未查询到符合条件的数据*/
				}
			}
		})
	}
}

/*YuO8szH0cVixePu/Bt+mG2xEldcD/te7MH4FzhVNtb+Aw0Pn8HvMYyRA4OFSt14I*/